<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">

<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">联系电话</label>-->
<!--            <div class="layui-input-block">-->
<!--                <input type="text" name="tel" class="layui-input"  placeholder="请输入联系电话" value="{$row.tel|default=''}">-->
<!--            </div>-->
<!--        </div>-->

        {if $row.scores && count(json_decode(json_encode($row.scores),true)) > 0}
        <div class="layui-form-item">
            <label class="layui-form-label">五星评价</label>
            <div class="layui-input-block">

                {foreach $row.scores as $ko => $vo}

                {foreach $vo as $ko1 => $vo1}
                <ul>
                    <li><span>{$ko1}</span> ： <sapn>{$vo1}分</sapn></li>

                </ul>

                {/foreach}
                {/foreach}
            </div>
        </div>
        {/if}
        {if $row.images}
        <div class="layui-form-item">
            <label class="layui-form-label required">图片/视频 以 | 做分割符号</label>
            <div class="layui-input-block layuimini-upload">
                <input name="images" class="layui-input layui-col-xs6"   placeholder="请上传图片/视频" value="{$row.images|default=''}" readonly='true'>
                <div class="layuimini-upload-btn">
                    <span><a class="layui-btn" data-upload="images" data-upload-number="more" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
                    <span><a class="layui-btn layui-btn-normal" id="select_images" data-upload-select="images" data-upload-number="more" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
                </div>
            </div>
        </div>
        {/if}
        {if $row.videos}
        <div class="layui-form-item" style="width:200%;">
            <label class="layui-form-label">评价视频</label>
            <div>
                <input  type="hidden" name="videos" class="layui-input layui-col-xs6"   placeholder="视频" value="{$row.videos|default=''}" readonly='true'>
                <video controls='controls' style="margin-top: 10px;max-width: 200px;width: 100%;max-height: 200px;">
                    <source src="{$row.videos|default=''}" type='video/mp4' id="video">
                </video>
                <p>
<!--                    <input type="text" name="goods_video" id="goods_video" style="display: none"><button style="margin-left:110px;" type="button" class="layui-btn" id="video_upload_btn">上传视频</button>-->
<!--                    <span style="color:brown">（支持AVI、mp4、wma、rm、rmvb、flash、mid、3GP格式）</span>-->
                </p>
            </div>
        </div>
<!--        <div class="layui-progress">-->
<!--            <div class="layui-progress-bar" lay-percent="40%"></div>-->
<!--        </div>-->
        {/if}

        {if $row.content}
        <div class="layui-form-item">
            <label class="layui-form-label">评价内容</label>
            <div class="layui-input-block">
                <textarea name="content" rows="20" class="layui-textarea editor" 评价内容 placeholder="请输入评价内容" readonly='true'>{$row.content|raw|default=''}</textarea>
            </div>
        </div>
        {/if}
        {if $row.isanonymous}
        <div class="layui-form-item">
            <label class="layui-form-label">是否匿名</label>
            <div class="layui-input-block">
                <input type="radio" name="isanonymous" lay-skin="primary"   value="1" title="是" disabled="disabled" {if $row.isanonymous eq 1}checked="" {/if} >
                <input type="radio" name="isanonymous" lay-skin="primary"   value="2" title="否" disabled="disabled" {if $row.isanonymous eq 2}checked="" {/if}>
            </div>
        </div>
        {/if}
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">所属管理员</label>-->
<!--            <div class="layui-input-block">-->
<!--                <input type="text" name="admin_id" class="layui-input"  placeholder="请输入所属管理员" value="{$row.admin_id|default=''}">-->
<!--            </div>-->
<!--        </div>-->
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<!--<script src="/static/plugs/layui-v2.5.6/layui.js"></script>-->
<script src="/static/plugs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script src="/static/admin/js/uploadVideo.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>
    //上传视频
    var goods_video = '';
    $(function () {
        var uploader_video = new plupload.Uploader({
            browse_button: 'video_upload_btn', // 上传按钮
            url: "/admin/evaluation.elist/auploadvideo", //远程上传地址
            filters: {
                max_file_size: '500mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
                mime_types: [//允许文件上传类型
                    {title: "files", extensions: "mpg,m4v,mp4,flv,3gp,mov,avi,rmvb,mkv,wmv"}
                ]
            },
            chunk_size: "500kb", //分片上传文件时，每片文件被切割成的大小，为数字时单位为字节。也可以使用一个带单位的字符串，如"200kb"。当该值为0时表示不使用分片上传功能
            multi_selection: false, //true:ctrl多文件上传, false 单文件上传
            init: {
                FilesAdded: function(up, files) { //文件上传前
                    plupload.each(files, function (file1) {
                        uploader_video.start();
                    });
                },
                UploadProgress: function(up, file) { //上传中，显示进度条
                    // $('#Progress').css('width', file.percent+'%');
                    console.log(file.percent+'%');
                },
                FileUploaded: function(up, file, info) { //文件上传成功的时候触发
                    var response = $.parseJSON(info.response);
                    if (response.error == 0) {
                        layer.msg('视频上传成功！');
                        setTimeout(function () {
                            var url = response.url;
                            $("#video").show().attr("src", url);
                            $("#video").parent().get(0).load();
                            goods_video = url;
                            $("[name='videos']").val(url)
                        }, 1000);
                    }
                    else {
                        layer.msg(response.message);return false;
                    }
                },
                Error: function(up, errObject) { //上传出错的时候触发
                    console.log(errObject);
                    alert('上传错误！');
                }
            }
        });
        uploader_video.init();
    });
</script>
